解决feign实现微服务间的文件上传出现错误the request was rejected because no multipart boundary was found |
您所在的位置:网站首页 › boundary not found › 解决feign实现微服务间的文件上传出现错误the request was rejected because no multipart boundary was found |
项目最开始的依赖 io.github.openfeign.form feign-form-spring 3.2.2 io.github.openfeign.form feign-form 3.2.2 commons-fileupload commons-fileupload 1.3.3说一下我怎么解决的吧,feign接口,配置,controller和参考的例子大同小异, 我是跟踪源码发现content-type会被","或";"进行转换为Map,跟踪代码为org.apache.tomcat.util.http.fileupload.FileUploadBase#getBoundary 截图 在org.apache.tomcat.util.http.fileupload.FileUploadBase.FileItemIteratorImpl#FileItemIteratorImpl抛出异常 请求头中内容为 //用户所调用的接口提交的content-type multipart/form-data; boundary=--------------------------381278542566024683689443 //经过feign转发请求后的content-type,按英文逗号拆分刚好Map没有boundary为key的值,索引报错 multipart/form-data, multipart/form-data; charset=UTF-8; boundary=16f0f6d2c45希望对大家有所帮助 解决方法为修改feign-form的版本 io.github.openfeign.form feign-form-spring 3.6.0 io.github.openfeign.form feign-form 3.6.0 commons-fileupload commons-fileupload 1.3.3
我的feign版本为 org.springframework.cloud spring-cloud-starter-openfeign 2.1.1.RELEASE org.springframework.cloud spring-cloud-starter-netflix-hystrix 2.1.1.RELEASE参考的例子: https://my.oschina.net/zyldsy/blog/1808419 https://www.jianshu.com/p/4ed2ac47d2f7 https://blog.csdn.net/Day_Day_No_Bug/article/details/90243042
|
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |